<?php

/**
 * JobeetJob form.
 *
 * @package    jobeet
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class JobeetJobForm extends BaseJobeetJobForm {

    public function configure() {
        $subForm = new sfForm();
        $JobeetJob = $this->getObject();


        if ($JobeetJob->isNew()) {
            for ($i = 0; $i < 2; $i++) {
                $JobeetJobTag = new JobeetJobTag();
                $JobeetJobTag->JobeetJob = $JobeetJob;

                $tag_form = new JobeetJobTagForm($JobeetJobTag);

                $subForm->embedForm($i, $tag_form);
            }
        } else {
            $JobeetJobTags = $JobeetJob->getTags();
            foreach ($JobeetJobTags as $k => $JobeetJobTag) {
                $JobeetJobTag->JobeetJob = $JobeetJob;
                $tag_form = new JobeetJobTagForm($JobeetJobTag);
                $subForm->embedForm($k, $tag_form );
            }
        }
        
        $this->embedForm('Tags', $subForm);
    }

}
